def jie(n):
    b = 1
    for i in range(2, n+1):
        b *= i
    return b

lists = []
for c in range(1, 21):
    d = jie(c)
    lists.append(d)

print(sum(lists))

# 方法2
import math
sum = 0
for i in range(1, 21):
    sum += math.factorial(i)

print(sum)

# 方法3
def jie_1(n):
    if n == 1:
        return 1
    else:
        return n * jie(n-1)

print(jie_1(4))